package com.waves.spring.boot.constructor;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationStartingEvent;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.GenericApplicationContext;

import java.util.Arrays;

/**
 * 添加事件监听器
 */
//@Configuration
public class Config4 {

    public static void main(String[] args) {
        SpringApplication application = new SpringApplication(Config4.class);
        application.addListeners(event -> System.out.println("\t事件为: " + event));
        ConfigurableApplicationContext context = application.run(args);
        context.close();
    }

//    @Bean
    public TomcatServletWebServerFactory servletWebServerFactory() {
        return new TomcatServletWebServerFactory();
    }


}
